package com.hjj.concurrence.syncMethod.t10;

public class Sub extends Main {
    @Override
    public /*synchronized*/ void serviceMethod() {
        try {
            System.out.println("int sub sleep begin threadName=" + Thread.currentThread().getName() + " time=" + System.currentTimeMillis());
            Thread.sleep(5000);
            System.out.println("int sub sleep end threadName=" + Thread.currentThread().getName() + " time=" + System.currentTimeMillis());
            super.serviceMethod();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        Sub sub = new Sub();
        ThreadA t1 = new ThreadA(sub);
        t1.setName("a");
        t1.start();
        ThreadB t2 = new ThreadB(sub);
        t2.setName("b");
        t2.start();
    }
}
